home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / STATUS.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  482 b   |  20 lines

  1.  /* status.c from page 247*/
  2.  #include <stdio.h>
  3.  #include <stdlib.h>
  4. main()
  5. {
  6.     float a;
  7.     double b = 1.e-40;
  8.     unsigned fpstatus;
  9.     printf("Before any computations");
  10.     fpstatus = _status87();
  11.     printf("status word is: %x\n", fpstatus);
  12.     /*perform operation that produces
  13.     * underflow and an inexact result */
  14.     a = b;                /*This will produce inexact result */
  15.     printf("After underflow/inexact");
  16.     fpstatus = _status87();
  17.     printf("status word is: %x\n", fpstatus);
  18. }
  19.  
  20.